<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>dom创建元素</title>
</head>
<body>
<script>
/*通过dom创建一个基本的html元素*/
let Odiv = document.createElement("div");
let Text = document.createTextNode("这是div标签");
let Objp = document.createTextNode("这是p标签");
Odiv.setAttribute("id","p1");
Odiv.appendChild(Text);
document.body.appendChild(Odiv);
Odiv.insertBefore(Objp,Odiv.childNodes[0]);
</script>
</body>
</html>
